<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>


<script runat="server">  
   protected void DetailsView1_DataBound(object sender, EventArgs e)
    {
        Label g = DetailsView1.FindControl("Gender") as Label;
        Label g1 = DetailsView1.FindControl("lbGender") as Label;
        if (g.Text.Trim() == "1")
        {
            g1.Text = "Male";
        }
        if (g.Text.Trim() == "0")
        {
            g1.Text = "Female";
        }
        
    
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        lbPID.Text = (DetailsView1.FindControl("lbID") as Label).Text;

    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ViewStaffInformation
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h1>Profile<asp:Label ID="lbPID" runat="server" Text="Label" Visible="False"></asp:Label>
    </h1>
    <p>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            CellPadding="4" DataSourceID="SqlDataSource1" 
            ForeColor="#333333" GridLines="None" Height="50px" Width="390px" 
            ondatabound="DetailsView1_DataBound" DataKeyNames="ID">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <Fields>
                <asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID">
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lbID" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="DateOfBirth" HeaderText="DateOfBirth" 
                    SortExpression="DateOfBirth" />
                <asp:BoundField DataField="PlaceOfBirth" HeaderText="PlaceOfBirth" 
                    SortExpression="PlaceOfBirth" />
                <asp:TemplateField HeaderText="Gender" SortExpression="Gender">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Gender") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Gender") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Gender" runat="server" Text='<%# Bind("Gender") %>' 
                            Visible="False"></asp:Label>
                        <asp:Label ID="lbGender" runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Degree" HeaderText="Degree" 
                    SortExpression="Degree" />
                <asp:BoundField DataField="UniOfGrad" HeaderText="UniOfGrad" 
                    SortExpression="UniOfGrad" />
                <asp:BoundField DataField="YearOfGrad" HeaderText="YearOfGrad" 
                    SortExpression="YearOfGrad" />
                <asp:BoundField DataField="PlaceOfMsc" HeaderText="PlaceOfMsc" 
                    SortExpression="PlaceOfMsc" />
                <asp:BoundField DataField="YearOfMsc" HeaderText="YearOfMsc" 
                    SortExpression="YearOfMsc" />
                <asp:BoundField DataField="PlaceOfPhd" HeaderText="PlaceOfPhd" 
                    SortExpression="PlaceOfPhd" />
                <asp:BoundField DataField="YearOfPhd" HeaderText="YearOfPhd" 
                    SortExpression="YearOfPhd" />
                <asp:BoundField DataField="Language" HeaderText="Language" 
                    SortExpression="Language" />
                <asp:BoundField DataField="Role" HeaderText="Role" 
                    SortExpression="Role" />
                <asp:BoundField DataField="Address" HeaderText="Address" 
                    SortExpression="Address" />
                <asp:BoundField DataField="Phone" HeaderText="Phone" 
                    SortExpression="Phone" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Status" HeaderText="Status" 
                    SortExpression="Status" />
                <asp:BoundField DataField="Major" HeaderText="Major" 
                    SortExpression="Major" />
            </Fields>
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:DetailsView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
            
            
            
            
            
            SelectCommand="SELECT Professor.Name, Professor.DateOfBirth, Professor.PlaceOfBirth, Professor.Gender, Professor.Degree, Professor.UniOfGrad, Professor.YearOfGrad, Professor.PlaceOfMsc, Professor.YearOfMsc, Professor.PlaceOfPhd, Professor.YearOfPhd, Professor.Language, Professor.Role, Professor.Address, Professor.Phone, Professor.Email, Professor.Status, Major.Name AS Major, Professor.ID FROM Professor INNER JOIN Major ON Professor.MajorID = Major.ID WHERE (Professor.ID = @ID)">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="" Name="ID" QueryStringField="id" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>

</asp:Content>
